package com.math.aistudykbr.controller;

import com.math.aistudykbr.service.BaiduOCRService;
import com.math.aistudykbr.utils.Result;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.ArrayList;

@RestController
@RequestMapping("/api/baidu-ocr")
@RequiredArgsConstructor
@Slf4j
public class BaiduOCRController {

    private final BaiduOCRService  baiduOCRService;

    @PostMapping("/imageToFont")
    public Result<ArrayList<String>> imageToFont(@RequestParam("image") MultipartFile image) throws IOException {
        return Result.success(200, "success", baiduOCRService.imageToFont(image));
    }
}
